<form action="index.php" method="post" id="frm"<?php if ('uploadDocument' == $this->cmd) { print(' enctype="multipart/form-data"'); } ?>>
<input type="hidden" name="cmd" value="<?php print($this->cmd); ?>">
<input type="hidden" name="ci" value="<?php print($this->ci->getId()); ?>">
<input type="hidden" name="type" value="<?php print($this->type); ?>">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr><td width="100%"><img src="public/images/spacer.gif" width="1" height="5"> </td></tr>
	<tr>
		<td align="left" valign="top">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr><td width="35%" align="left" valign="top" class="headingCell1">FILE INFORMATION</td><td>&nbsp;</td></tr>
			</table>
		</td>
	</tr>

	<tr>
		<td align="left" valign="top" class="borders">
			<table width="100%" border="0" cellspacing="0" cellpadding="3">
<?php
    $failed =  (isset($_REQUEST['Submit']) && trim($_REQUEST['Submit'])==true)?true:false;
    $failedTitle = (trim($this->title)==false && $failed);
    $titleClass = $failedTitle? ' class="invalid"':"";

?>
                <tr valign="middle"<?php print($titleClass); ?>>
					<td width="35%" align="right" bgcolor="#CCCCCC"><div align="right" class="strong"><font color="#FF0000"><strong>*</strong></font>Document Title:</div></td>
					<td align="left"><INPUT TYPE="text" NAME="title" SIZE=50 <?php print($this->title?" value=\"{$this->title}\"":''); ?>><?php if ($failedTitle){ ?><span class="invalid">Please provide a title.</span><?php } ?></td>
				</tr>

				<tr valign="middle">
					<td width="35%" height="31" align="right" bgcolor="#CCCCCC"><div align="right" class="strong">Author/Composer:</div></td>
					<td align="left"><INPUT TYPE="text" NAME="author" SIZE=50 <?php print($this->author?" value=\"{$this->author}\"":''); ?>></td>
				</tr>
<?php
if ($this->type == "URL")
{
    $failedUrl = !Validator_Url::validate($this->url) && $failed;
    $urlClass = $failedUrl? ' class="invalid"':"";
    ?>
    				<tr valign="middle"<?php print($urlClass); ?>>
    					<td align="right" bgcolor="#CCCCCC"><div align="right" class="strong"><font color="#FF0000"><strong>*</strong></font>URL:</div></td>
    					<td align="left"><input name="url" type="text" size="50" <?php print($this->url?" value=\"{$this->url}\"":''); ?>><?php if ($failedUrl){ ?><span class="invalid">Please provide a valid url.</span><?php } ?></td>
    				</tr>
    				<tr>
    					<td align="right" bgcolor="#CCCCCC">&nbsp;</td>
    					<td><font size='-2'>
    						   http://www.reservesdirect.org<br/>
    						   http://links.jstor.org/xxxxx<br/>
    						   http://dx.doi.org/10.xxxxx
    						</font>
    					</td>
    				</tr>
<?php
} else { ?>
    				<tr valign="middle">
    					<td align="right" bgcolor="#CCCCCC"><div align="right" class="strong"><font color="#FF0000"><strong>*</strong></font>File:</div></td>
    					<td align="left"><INPUT TYPE="file" NAME="userFile" SIZE=40 <?php print($this->userFile ? " value=\"{$this->userFile}\"":''); ?>></td>
    				</tr>

    				<tr valign="middle">
    					<td align="right" bgcolor="#CCCCCC"><div align="right" class="strong">&nbsp;</div></td>
    					<td align="left">Please limit uploaded documents to <?php print($this->uploadLimit); ?>.</td>
    				</tr>
<?php
}

if ($this->docTypeIcons)
{ ?>
    				<tr valign="middle">
    					<td width="35%" align="right" bgcolor="#CCCCCC"><span class="strong">Document Type Icon:</span></td>
    					<td align="left">
    						<select name="selectedDocIcon" onChange="document.iconImg.src = this[this.selectedIndex].value;">
<?php
    $selectedSource = reserveItem::getGenericIcon();
    for ($j = 0; $j<count($this->docTypeIcons); $j++)
    {
        $selected = ($this->selectedDocIcon == $this->docTypeIcons[$j]['helper_app_icon'])? true:false;
        $selectedIcon = ($selected)?" selected":'';
        if ($selected) $selectedSource = $this->docTypeIcons[$j]['helper_app_icon'];
?>
        						<option value="<?php print( $this->docTypeIcons[$j]['helper_app_icon']); ?>"<?php echo $selectedIcon; ?>> <?php print($this->docTypeIcons[$j]['helper_app_name']);?></option>
<?php    } ?>

    						</select>
    					<img name="iconImg" width="24" height="20" border="0" src="<?php print($selectedSource) ?>">
    					</td>
    				</tr>
<?php } ?>

				<tr valign="middle">
					<td width="35%" align="right" bgcolor="#CCCCCC"><div align="right"><span class="strong">Performer </span>(<em>if applicable)</em><span class="strong">:</span></div></td>
					<td align="left"><input name="performer" type="text" id="Title3" size="50" <?php print($this->performer?" value=\"{$this->performer}\"":''); ?>></td>
				</tr>

				<tr valign="middle">
					<td width="35%" align="right" bgcolor="#CCCCCC"><div align="right"><span class="strong">Book/Journal/Work Title</span> (<em>if applicable</em>)<span class="strong">:</span></div></td>
					<td align="left"><INPUT TYPE="text" NAME="volumetitle" SIZE=50 <?php print($this->volumetitle?" value=\"{$this->volumetitle}\"":''); ?>></td>
				</tr>

				<tr valign="middle">
					<td width="35%" align="right" bgcolor="#CCCCCC"><div align="right"><span class="strong">Volume / Edition</span> (<em>if applicable</em>)<span class="strong">:</span></div></td>
					<td align="left"><INPUT TYPE="text" NAME="volume" SIZE=50 <?php print($this->volume?" value=\"{$this->volume}\"":''); ?>></td>
				</tr>

				<tr valign="middle">
					<td width="35%" align="right" bgcolor="#CCCCCC"><div align="right"><span class="strong">Pages</span> (<font color="#FF0000"><strong>*</strong></font><em>if applicable</em>)<span class="strong">:</span></div></td>
					<td align="left"><INPUT TYPE="text" NAME="pagefrom" ID="pagefrom" SIZE=3 <?php print($this->pagefrom?" value=\"{$this->pagefrom}\"":''); ?>>  Of:  <INPUT TYPE="text" NAME="pageto" ID="pageto" SIZE=3 <?php print($this->pageto?" value=\"{$this->pageto}\"":''); ?>>
						<font size='-2'>1 page uploaded of 10 pages total in work</font>
					</td>
				</tr>

				<tr valign="middle">
					<td width="35%" align="right" bgcolor="#CCCCCC"><div align="right"><span class="strong">Times</span> (<font color="#FF0000"><strong>*</strong></font><em>if applicable</em>)<span class="strong">:</span></div></td>
					<td align="left"><INPUT TYPE="text" NAME="timefrom" ID="timefrom" SIZE=3 <?php print($this->timefrom?" value=\"{$this->timefrom}\"":''); ?>>  Of:  <INPUT TYPE="text" NAME="timeto" ID="timeto" SIZE=3 <?php print($this->timeto?" value=\"{$this->timeto}\"":''); ?>>
						<font size='-2'>1:23 minutes uploaded of 10:39 minutes total in work</font>
					</td>
				</tr>

				<tr valign="middle">
					<td width="35%" align="right" bgcolor="#CCCCCC"><div align="right"><span class="strong">Source / Year</span> (<em>if applicable</em>)<span class="strong">:</span></div></td>
					<td align="left"><INPUT TYPE="text" NAME="source" SIZE=50 <?php print($this->source?" value=\"{$this->source}\"":''); ?>></td>
				</tr>

				<tr valign="middle">

<?php
if (Account_Rd::atLeastStaff()) { ?>
    					<td width="35%" align="right" bgcolor="#CCCCCC"><div align="right"><span class="strong">Note</span>(<em>if applicable</em>)<span class="strong">:</span></div></td>
    					<td align="left"><TEXTAREA NAME="noteText" cols=50 rows=3><?php print($this->noteText?"{$this->noteText}":''); ?></TEXTAREA><br>

          			<span class="small">Note Type:
          			<?php 
          				$contentNoteChecked = ($this->noteTypes['content'] == $this->noteType ? ' checked="checked"' : '');
          				$instructorNoteChecked = ($this->noteTypes['instructor'] == $this->noteType ? ' checked="checked"' : '');
          				$staffNoteChecked = ($this->noteTypes['staff'] == $this->noteType ? ' checked="checked"' : '');
          				$copyrightNoteChecked = ( $this->noteTypes['copyright'] == $this->noteType ? ' checked="checked"': '');
          			?>
    					<label><input type="radio" name="noteType" value="<?php print($this->noteTypes['content']); ?>"<?php print($contentNoteChecked);?>>Content Note</label>
    					<label><input type="radio" name="noteType" value="<?php print($this->noteTypes['instructor']); ?>"<?php print($instructorNoteChecked);?>>Instructor Note</label>
    					<label><input type="radio" name="noteType" value="<?php print($this->noteTypes['staff']); ?>"<?php print($staffNoteChecked);?>>Staff Note</label>
    					<label><input type="radio" name="noteType" value="<?php print($this->noteTypes['copyright']); ?>"<?php print($copyrightNoteChecked);?>>Copyright Note</label>
    					</span>
<?php
} else { ?>
    					<td width="35%" align="right" bgcolor="#CCCCCC"><div align="right"><span class="strong">Instructor Note</span>(<em>if applicable</em>)<span class="strong">:</span></div></td>
    					<td align="left"><TEXTAREA NAME="noteText" cols=50 rows=3><?php print($this->noteText?"{$this->noteText}":''); ?></TEXTAREA><br>
    					<input type="hidden" name="noteType" value="<?php print($this->noteTypes['instructor']); ?>">
<?php } ?>
</td>
				</tr>

				<tr valign="middle">
					<td width="35%" align="right" bgcolor="#CCCCCC"><div align="right"><span class="strong">This document is from my personal collection:</span> (<em>if applicable</em>)<span class="strong">:</span></div></td>
					<td align="left"><INPUT TYPE="checkbox" NAME="personal"<?php echo ($this->personal)?' checked="checked"':''?>></td>
				</tr>



			</table>
		</td>
	</tr>
	<tr><td><img src="public/images/spacer.gif" width="1" height="15"></td></tr>
<?php
if ($this->type == "URL")
{ ?>
    				<tr><td width="20%" valign="top" colspan="3" align="center"><input type="submit" name="Submit" value="Save URL"></td></tr>
<?php } else { ?>
    				<tr><td width="20%" valign="top" colspan="3" align="center">
    						<div style="font:arial; font-weight:bold; font-size:small; padding:5px;">I have read the Library's <a href="<?php print($this->copyrightNoticeURL); ?>" target="blank">copyright notice</a> and certify that to the best of my knowledge my use of this document falls within those guidelines.</div>
    						<br><input type="submit" name="Submit" value="Save Document">
    				</td></tr>
<?php
} ?>
</table>
</form>
